﻿using System;
using System.Data;
using DTO;

namespace DAO
{
    public class BaseOperationImplement<T> 
    {
        private readonly Helper _helper = new Helper();

        public DataTable GetAllObject(string table)
        {
            return _helper.GetDataTable(string.Format("SELECT * FROM {0}", table));
        }

        public DataSet GetDataSet(string query)
        {
            return _helper.GetDataSet(query);
        }

        public DataTable GetDataTable(string query)
        {
            return _helper.GetDataTable(query);
        }


        public int AddObject(string procName, CommandType commandType, params Object[] parameters)
        {
            return _helper.ExecuteNonQuery(procName, commandType, parameters);
        }

        public int EditObject(string procName, CommandType commandType, params Object[] parameters)
        {
            return _helper.ExecuteNonQuery(procName, commandType, parameters);
        }

        public int DeleteObject(string procName, CommandType commandType, params Object[] parameters)
        {
            return _helper.ExecuteNonQuery(procName, commandType, parameters);
        }

        public int AutoIncrementIdObject(string table, string column)
        {
            return _helper.AutoIncrementID(table, column);
        }
    }
}